package leecode

func distinctPrimeFactors(nums []int) int {
	hashMap := make(map[int]bool)
	for _, num := range nums {
		for i := 2; i*i <= num; i++ {
			if num%i == 0 {
				hashMap[i] = true
				for num%i == 0 {
					num = num / i
				}
			}
		}
		if num > 1 {
			hashMap[num] = true
		}
	}
	return len(hashMap)
}
